const { subjectsModel } = require('../models/subjectsModel')
module.exports.createSubjects = async function(req, res){
    try{
        const data = req.body;
        const result = await subjectsModel.create(data)
        res.send({
            message:'专业数据新增成功',
            code:1
        })
    }catch(error){
        console.log('服务器错误', error);
        res.send({
            message:'专业数据新增失败',
            code:0
        })
    }
}

module.exports.getSubjects = async function(req, res){
    const result = await subjectsModel.find();
    res.send({
        message:'专业数据获取成功',
        code: 1,
        result
    })
  }